package com.zz.inventory.feign;

import com.ruoyi.common.core.web.domain.AjaxResult;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class TeacherExamFallbackFactory implements FallbackFactory<TeacherExamFeignClient> {

    @Override
    public TeacherExamFeignClient create(Throwable cause) {
        return new TeacherExamFeignClient() {
            @Override
            public AjaxResult getStudentExamRecords(Long studentId) {
                String errorMsg = "远程查询学生[" + studentId + "]考试记录失败：" + cause.getMessage();
                return AjaxResult.error(errorMsg);
            }

            @Override
            public AjaxResult deleteExamRecordsByStudentId(Long studentId) {
                String errorMsg = "远程删除学生[" + studentId + "]考试记录失败：" + cause.getMessage();
                return AjaxResult.error(errorMsg);
            }
        };
    }
}